//Accepted
#include <cstdio>

#define max 5000


int a[max][max];
int t, x=1, y=-1, i=0, j=2, k=0;

int main (){
	//freopen("in.txt", "r", stdin);freopen("out.txt", "w", stdout);
	while((x<max)&&(y<max)){
		if(i)
			++x;
		else
			--x;
		
		if(j)
			y++;
		else
			y--;
		
		a[y][x]=k;
		
		i=(i+1)%4;
		j=(j+1)%4;
		++k;
	}
	
	scanf("%d", &t);
	while(t--){
		scanf("%d%d", &x, &y);
		if(!(x+y))printf("0\n");
		else if(a[y][x])printf("%d\n", a[y][x]);
		else printf("No Number\n");
	}
	return 0;
}
